package com.lry.write;

import com.lry.Node;
import lombok.extern.slf4j.Slf4j;

import java.util.List;
import java.util.Random;
import java.util.concurrent.CompletableFuture;

/**
 * 写成功一个即可返回
 */
@Slf4j
public class WriteOne extends AbstractWriteConsistency implements WriteConsistency {

    private Random random = new Random();

    @Override
    public String put(String key, String value, List<Node> nodes) {

        List<CompletableFuture<String>> futures = super.putAsync(key,value,nodes);

        return super.putReturn(futures,1);

    }

}
